import json
from dydx3 import Client # pip install dydx-v3-python
from dydx3.constants import MARKET_BTC_USD
from dydx3.constants import ORDER_SIDE_SELL
from dydx3.constants import ORDER_TYPE_LIMIT
from dydx3.constants import ORDER_STATUS_OPEN

# refer to link: https://docs.dydx.exchange/#send-user-link-request

# xunke00
#client = Client(
#    host='https://api.dydx.exchange',
#    api_key_credentials={
#        'key': '<access_key>',
#        'secret': '<secret_key>',
#        'passphrase': '<password>',
#    },
#)

# xunke01
#client = Client(
#    host='https://api.dydx.exchange',
#    api_key_credentials={
#        'key': '<access_key>',
#        'secret': '<secret_key>',
#        'passphrase': '<password>',
#    },
#)

# query
#res = client.public.get_markets()
#res = client.private.get_user()
res = client.private.get_user_links()
#res = client.private.get_accounts()
#res = client.private.get_user_pending_link_requests()

# update
#res = client.private.send_link_request('CREATE_SECONDARY_REQUEST', '<wallet_address>')
#res = client.private.send_link_request('ACCEPT_PRIMARY_REQUEST', '<wallet_address>')
#res = client.private.send_link_request('REMOVE', '<wallet_address>')
#res = client.private.get_orders(market=MARKET_BTC_USD,
#                                status=ORDER_STATUS_OPEN,
#                                side=ORDER_SIDE_SELL,
#                                limit=50)
#res = client.private.get_fills(
#  market=MARKET_BTC_USD,
#)

print(json.dumps(res.data))
